#!/usr/bin/env pythonpagenum

from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask import render_template
from flask import request
 


# 实例化
app = Flask(__name__)

# 连接到数据库
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = True
app.config['SQLALCHEMY_DATABASE_URI'] = "mysql+pymysql://root:111111@localhost/test"
db = SQLAlchemy(app)

#定义类映射到test.stu
class stuInfo(db.Model):
    __tablename__ = 'stu'
    id = db.Column(db.Intege)
    sex = db.Column(db.String)
    age = db.Column(db.Integer)
    num = db.Column(db.String, unique=True)
    address = db.Column(db.String)
    grade = db.Column(db.Integer)
    sub = db.Column(db.String)
    name = db.Column(db.String, unique=True)

@app.route('/')
def v_index():
    return render_template('stuinfo.html')
#    return 'hello world! i am DT'

def get(self,maxline,pagenum):
    offset = (pagenum-1)*maxline
    limit = maxline
    stu_list = stuInfo.query.order_by(student.id.desc()).limit(limit).offset(offset(offset).all())
    stulist = []
    tmp_list = []
    for i in stu_list:
        stulist.append(i)
    for stu in stulist:
        tmp={}
        tmp['stu_id']

#@app.route('/addinfo',methods=["POST"])
#def addinfo():
#    stu_info = stuInfo(sex=request.form['sex'],age=request.form['age'],num=request.form['num'],address=request.form['address'],grade=request.form['grade'],sub=request.form['sub'],name=request.form['name'])
#    db.session.add(stu_info)
#    db.session.commit()
#    return '信息插入成功'



if __name__ == '__main__':
    app.run(host='0.0.0.0',port=8089,debug=True,threaded=True)
